<template>
	<div class="s_video">
		<ul class="clear" v-loading="loading">
			<template   v-for="(item ,index) of VideoList">
				<li class="i_hotListD fl" :key="index">
				<a target="_blank" :href="BASE_URL + item.video_url">
					<img :src="BASE_URL+item.picture" :onerror="errorImg">
				</a>
				<div class="i_uClassTxt">
					<a target="_blank"  :href="BASE_URL + item.video_url" :title="item.video_name">{{item.video_name}}</a>
					<!-- <router-link to="###" :title="item.title">{{item.title}}</router-link > -->
					<div class="i_hotType2 clear">
						<router-link to="###">
							<span>
								<img :src="BASE_URL+item.avatar_path">
							</span>
							{{item.user_name}}
						</router-link >
						<div class="i_hCollect fr">
							<img src="../../assets/images/xin.png" class="xin_icon">
							<strong>{{item.clicks}}</strong>
						</div>
					</div>
				</div>
			</li>

			</template>
		
		</ul>
		<el-pagination v-if="parseInt(total_number) > page_size"
	      @current-change="changePage"
	      :current-page="page_index"
	      :page-size="page_size"
	      layout="prev, pager, next"
	      :total="total_number">
	    </el-pagination>
	    <div class="dependent" v-if="placeholder">
	    	<i class="ipm image_nofound"></i>
	    	<p>
	    		还没发现任何相关的内容哦~
	    	</p>
	    </div>
	</div>
</template>

<script>
	export default{
		name: '',
		data() {
			return {
				listVideoParam:{
					// type:2,
					create_id: this.$route.query.id,
					page_index:1,
					page_size:12,
				},

				create_id: this.$route.query.id,
				page_index:1,
				page_size:12,
				stutas: '1,2,3',
				
				total_number:0,
				VideoList:[],
				errorImg: 'this.src="' + require('../../../public/images/image20.png') + '"',
				placeholder: false,
				loading: true
			}
		},
		created(){
	       this.getVideoList();
	       // console.info(this.$root.activeIndex,10)
		},
		methods: {
			//分页改变
            changePage(val) {
            	this.page_index = val;
    			this.getVideoList();
            },

            getVideoList(){
            	let success = (data=>{
            		this.VideoList = data.data.data;
            		//console.info(this.VideoList)
            		this.total_number = data.data.data_sum;

            		this.loading = false
            		this.VideoList.length === 0
            		? this.placeholder = true
            		: this.placeholder = false
            	})
            	//执行请求，并将回调方法变成config成员以便鉴权过期可以执行
            	// this.$ajax.get('api/video/teacher_video',{params: this.listVideoParam,func:{success:success}})

            	if (this.$g.user_id == this.create_id) {
            		this.$ajax.get('api/video/video_list',{
            			params: {
            				create_id: this.$route.query.id,
            				page_index: this.page_index,
            				page_size:this.page_size,
            				stutas: '1,2,3',
            			},
            			func:{success:success}
            		})
            	}else{
            		this.$ajax.get('api/video/video_list',{
            			params: {
            				create_id: this.$route.query.id,
            				page_index: this.page_index,
            				page_size:this.page_size,
            				stutas: '1',
            				authority:1
            			},
            			func:{success:success}
            		})
            	}
            	// this.$ajax.get('api/video/video_list',{params: this.listVideoParam,func:{success:success}})
            },
           
		}
	}
</script>